package com.leco.demo.spring;

import com.leco.demo.spring.processor.MyBeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.support.GenericApplicationContext;

/**
 * @author greg
 * @version 2022/10/23
 * 自定义ApplicationContext，通过模板方法postProcessBeanFactory添加BeanFactoryPostProcessor
 **/
public class MyApplicationContext extends GenericApplicationContext {
    @Override
    protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
        this.addBeanFactoryPostProcessor(new MyBeanFactoryPostProcessor());
    }
}
